#pragma once

#include "AIPackage.h"
#include <map>
#include <functional>

namespace ai
{

	typedef std::function<AIValue (AIActor*) > AIExpr;

	namespace expr
	{
		AIExpr getMemValue(unsigned int memKey);
		AIExpr and(const AIExpr& a, const AIExpr& b);
	}

	class AIRule
	{
	public:
		AIRule(const AIRule& other);
		AIRule(unsigned int memKey, AIExpr expression);

		void run(AIActor* actor);
	protected:
		unsigned int _memKey;
		AIExpr _expression;
	};


	class AIRuleSet
	{
	public:
		void AddRule(const AIRule& rule);
	protected:
		std::vector<AIRule> _rules;
	};

	class AIRuleSetPackage : public AIPackage
	{
	public:
		virtual void run(AIActor* actor ) const;

	protected:
		AIRuleSet* _rules;
	};
}